/*
 *    Copyright © OpenAtom Foundation.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.inspur.edp.bff.api.manager.context;

import com.inspur.edp.bff.entity.defaultvalue.VoDefaultValue;
import com.inspur.edp.cef.entity.entity.IEntityData;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * 数据Mapping以及数据反向Mapping上下文
 * 数据Mapping：将be数据结构转换为vo数据结构
 * 数据反向Mapping：将vo数据结构转换为be数据结构
 * 扩展动作执行顺序可参考：<a href=https://open.inspuronline.com/iGIX/#/document/mddoc/docs-gsp-cloud-ds%2Fdev-guide-beta%2Fadvanced-development%2Fvo-relatedcomponent-development%2F%E6%89%A9%E5%B1%95%E5%8A%A8%E4%BD%9C%2Fvo%E6%89%A9%E5%B1%95%E5%8A%A8%E4%BD%9C.md">点击这里</a>查看。
 */
public class DataMapperContext {

    private HashMap<String, ArrayList<IEntityData>> sourceData = new HashMap<String, ArrayList<IEntityData>>();
    private HashMap<String, ArrayList<IEntityData>> mappedData = new HashMap<String, ArrayList<IEntityData>>();
    private ArrayList<IEntityData> targetResult = new ArrayList<IEntityData>();
    private boolean privateIsNew = false;
    private VoDefaultValue voDefaultValue;

    /**
     * 数据源（Be，Qo等）数据集合
     * Key是数据源编号，内部默认Key值使用Default，开发时请注意不要使用该Key值,以免出现未知问题。
     * Value是数据源数据
     */
    public final HashMap<String, ArrayList<IEntityData>> getSourceData() {
        return sourceData;
    }

    public final void setSourceData(HashMap<String, ArrayList<IEntityData>> value) {
        sourceData = value;
    }

    /**
     * 映射结果集合
     * Key是数据源编号，内部默认Key值使用Default，开发时请注意不要使用该Key值,以免出现未知问题。
     * Value是数据源数据
     */
    public final HashMap<String, ArrayList<IEntityData>> getMappedData() {
        return mappedData;
    }

    public final void setMappedData(HashMap<String, ArrayList<IEntityData>> value) {
        mappedData = value;
    }

    /**
     * Vo数据集，这里的数据指的是：经过数据映射之后，将{@link #getSourceData()}方法中获取的源数据转换为vo结构的数据集
     */
    public final ArrayList<IEntityData> getTargetResult() {
        return targetResult;
    }

    public final void setTargetResult(ArrayList<IEntityData> value) {
        targetResult = value;
    }

    /**
     * 判断数据是否是新增状态
     *
     * @return
     */
    public final boolean getIsNew() {
        return privateIsNew;
    }

    public final void setIsNew(boolean value) {
        privateIsNew = value;
    }

    /**
     * 获取外部以及实体上设置的默认值
     *
     * @return
     */
    public final VoDefaultValue getVoDefaultValue() {
        return voDefaultValue;
    }

    public final void setVoDefaultValue(VoDefaultValue value) {
        voDefaultValue = value;
    }
}
